<?php

namespace app\common\model\driving;

use think\Model;

/**
 * 司机意见反馈模型
 */
class DriverFeedback extends Model
{





    // 表名
    protected $name = 'driving_driver_feedback';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [

    ];

    // 字段类型或者格式转换
    protected $type = [
        'createtime' => 'datetime:Y-m-d H:i:s',
    ];

    protected static function init()
    {
        self::beforeInsert(function ($row) {
            $changed = $row->getChangedData();
        });

        self::beforeUpdate(function ($row) {
            $changed = $row->getChangedData();
        });

        self::afterInsert(function ($row) {
            $changed = $row->getChangedData();
        });

        self::afterUpdate(function ($row) {
            $changed = $row->getChangedData();
        });
    }







    public function driver()
    {
        return $this->belongsTo('Driver', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }
}
